load("@fbsource//tools/build_defs:rust_binary.bzl", "rust_binary")
load("@fbsource//tools/build_defs:rust_library.bzl", "rust_library")

oncall("scm_server_infra")

rust_binary(
    name = "builder",
    srcs = glob(["builder/**/*.rs"]),
    autocargo = {"cargo_toml_dir": "builder"},
    deps = [
        "fbsource//third-party/rust:anyhow",
        "fbsource//third-party/rust:async-trait",
        "fbsource//third-party/rust:clap",
        "fbsource//third-party/rust:futures",
        "fbsource//third-party/rust:tracing",
        ":microwave",
        "//common/rust/shed/cloned:cloned",
        "//common/rust/shed/facet:facet",
        "//common/rust/shed/fbinit:fbinit",
        "//eden/mononoke/blobrepo:blobrepo_override",
        "//eden/mononoke/blobstore:blobstore_factory",
        "//eden/mononoke/cmdlib/mononoke_app:mononoke_app",
        "//eden/mononoke/derived_data/filenodes_derivation:filenodes_derivation",
        "//eden/mononoke/derived_data/mercurial_derivation:mercurial_derivation",
        "//eden/mononoke/features/cache_warmup:cache_warmup",
        "//eden/mononoke/mercurial:mercurial_types",
        "//eden/mononoke/metaconfig:metaconfig_types",
        "//eden/mononoke/mononoke_macros:mononoke_macros",
        "//eden/mononoke/mononoke_types:mononoke_types",
        "//eden/mononoke/repo_attributes/bonsai_hg_mapping:bonsai_hg_mapping",
        "//eden/mononoke/repo_attributes/bookmarks:bookmarks",
        "//eden/mononoke/repo_attributes/bookmarks/bookmarks_cache:bookmarks_cache",
        "//eden/mononoke/repo_attributes/bookmarks/warm_bookmarks_cache:warm_bookmarks_cache",
        "//eden/mononoke/repo_attributes/commit_graph/commit_graph:commit_graph",
        "//eden/mononoke/repo_attributes/filenodes:filenodes",
        "//eden/mononoke/repo_attributes/mutable_blobstore:mutable_blobstore",
        "//eden/mononoke/repo_attributes/repo_blobstore:repo_blobstore",
        "//eden/mononoke/repo_attributes/repo_derived_data:repo_derived_data",
        "//eden/mononoke/repo_attributes/repo_identity:repo_identity",
        "//eden/mononoke/server/context:context",
    ],
)

rust_library(
    name = "microwave",
    srcs = glob(["src/**/*.rs"]),
    autocargo = {"cargo_toml_dir": "features/microwave"},
    deps = [
        "fbsource//third-party/rust:anyhow",
        "fbsource//third-party/rust:futures",
        "fbsource//third-party/rust:tokio",
        "fbsource//third-party/rust:tracing",
        "//eden/mononoke/blobstore:blobstore",
        "//eden/mononoke/features/microwave/if:microwave-if-rust",
        "//eden/mononoke/mercurial:mercurial_types",
        "//eden/mononoke/mononoke_types:mononoke_types",
        "//eden/mononoke/repo_attributes/filenodes:filenodes",
        "//eden/mononoke/repo_attributes/mutable_blobstore:mutable_blobstore",
        "//eden/mononoke/repo_attributes/repo_identity:repo_identity",
        "//eden/mononoke/server/context:context",
        "//thrift/lib/rust:fbthrift",
    ],
)
